package com.open.demo.api;

import java.util.HashMap;

/**
 * RxVolley Http 封装.
 * http://rxvolley.mydoc.io/ 教程.
 */
public class HttpRequstHelp {

    public static HttpRequstHelp sInstance = new HttpRequstHelp();
    private HttpRequestUse mHttpRequestUse;

    private HttpRequstHelp() {
        mHttpRequestUse = new AsyncHttpRequst(); // 默认.
    }

    public static HttpRequstHelp getInstance() {
        return HttpRequstHelp.sInstance;
    }

    public HttpRequstHelp setHttpRequestUse(HttpRequestUse httpRequestUse) {
        this.mHttpRequestUse = httpRequestUse;
        return this;
    }

    public void get(String url, HashMap<String, Object> params, final HttpCallBack cb) {
        mHttpRequestUse.get(url, params, cb);
    }

    public void get(String url, final HttpCallBack cb) {
        mHttpRequestUse.get(url, null, cb);
    }

    public void post(String url, HashMap<String, Object> params, final HttpCallBack cb) {
        mHttpRequestUse.post(url, null, cb);
    }

}
